//
//  CXCoverHUD.m
//  XiMaFM
//
//  Created by hcios on 2017/9/9.
//  Copyright © 2017年 hcios. All rights reserved.
//

#import "CXCoverHUD.h"

#define kWindow  [UIApplication sharedApplication].keyWindow

@implementation CXCoverHUD

+(void)show{
    //1. 创建HUD
    CXCoverHUD * coverHUD = [[CXCoverHUD alloc] init];
    
    //添加到窗口
    [[UIApplication sharedApplication].keyWindow addSubview:coverHUD];
    
    //设置frame
    coverHUD.frame = [UIScreen mainScreen].bounds;
    
    coverHUD.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.6];
    
    
}

+(void)hide{
    //    影藏HUD
    
    for (UIView * view in kWindow.subviews) {
        if ([view  isKindOfClass:[self class]]) {
            //当前类
            [view removeFromSuperview];
            break;
        }
    }
}

@end
